home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / • Other Platforms / PCCTS 1.31 / non-MPW / NOTES.OS2 < prev    next >
Encoding:
Text File  |  1995-03-10  |  8.1 KB  |  297 lines  |  [TEXT/MPS ]

  1. 14 April 94
  2. Version 1.20 of pccts
  3.  
  4. At the moment this help file is available via anonymous FTP at
  5.  
  6.         Node: marvin.ecn.purdue.edu
  7.         File: pub/pccts/1.20/NOTES.OS2
  8.  
  9. Mail corrections or additions to Steve Robenalt <steve@molly.dny.rockwell.com>
  10. ===============================================================================
  11. Notes on building PCCTS under OS/2 2.X with the C Set compilers.
  12.  
  13. The supplied makefiles can be used to build PCCTS under OS/2 with minimal
  14. trouble. First you need to edit the makefiles such that the Unix specific
  15. defaults are commented out, then uncomment the lines which are specific
  16. to OS/2 and C Set/2 compilers as originally set up by Ed Harfmann. Note
  17. also that you need to use the target list which reflects the appropriate
  18. naming conventions. Some of the lines now need to be changed to reflect
  19. differences in conventions between the operating systems: 1) change forward
  20. slashes in directories to backslashes, 2) change command line parameters
  21. from -option to /option (note that this applies to C Set, not ANTLR and DLG
  22. options), and 3) change rm to del for clean and scrub targets.
  23.  
  24. To build ANTLR for the first time:
  25.  
  26. note: I tried various combinations of "touch"ing files to try to prevent nmake
  27.       from using ANTLR to rebuild itself, and was unsuccessful.
  28.  
  29. In the section labelled "Target list of PC machines", comment out the
  30. scan.c and antlr.c dependencies. This prevents nmake from trying to invoke
  31. ANTLR to build itself. After you have built ANTLR successfully for the first
  32. time, you can uncomment these lines and it will build itself normally. (If you
  33. had a working 1.10 installation before, you can also use the older binaries
  34. when building the new ones.)
  35.  
  36. An example of the resulting makefile, with all the extra baggage for Unix, DOS,
  37. and OS/2 1.X is shown here:
  38.  
  39. ----- cut here -----
  40.  
  41. #
  42. # Makefile for ANTLR 1.20
  43. #
  44. # SOFTWARE RIGHTS
  45. #
  46. # We reserve no LEGAL rights to the Purdue Compiler Construction Tool
  47. # Set (PCCTS) -- PCCTS is in the public domain.  An individual or
  48. # company may do whatever they wish with source code distributed with
  49. # PCCTS or the code generated by PCCTS, including the incorporation of
  50. # PCCTS, or its output, into commerical software.
  51. # We encourage users to develop software with PCCTS.  However, we do ask
  52. # that credit is given to us for developing PCCTS.  By "credit",
  53. # we mean that if you incorporate our source code into one of your
  54. # programs (commercial product, research project, or otherwise) that you
  55. # acknowledge this fact somewhere in the documentation, research report,
  56. # etc...  If you like PCCTS and have developed a nice tool with the
  57. # output, please mention that you developed it using PCCTS.  In
  58. # addition, we ask that this header remain intact in our source code.
  59. # As long as these guidelines are kept, we expect to continue enhancing
  60. # this system and expect to make other tools available as they are
  61. # completed.
  62. #
  63. # ANTLR 1.20
  64. # Terence Parr
  65. # Purdue University
  66. # With AHPCRC, University of Minnesota
  67. # 1989-1994
  68. #
  69. # Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
  70. # Ed Harfmann
  71. # Micro Data Base Systems
  72. # Lafayette, Indiana
  73. # - With updates by Steve Robenalt 4/94
  74. #
  75. SET=..\support\set
  76. PCCTS_H=..\h
  77.  
  78. #
  79. # C-Set/2 for OS/2
  80. #
  81. CC=icc
  82. CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
  83. OUT_OBJ = /Fo
  84. LIBS=
  85. ANTLR=..\bin\antlr
  86. DLG=..\bin\dlg
  87. OBJ_EXT = obj
  88.  
  89. antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
  90.         fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
  91.         misc.obj set.obj pred.obj dialog.obj
  92.         link386 @<<
  93. $** /NOI
  94. $@ /STACK:32768
  95.  
  96. $(LIBS: = +^
  97. )
  98. $(DEF_FILE) $(LFLAGS) ;
  99. <<
  100.         copy *.exe ..\bin
  101.  
  102. #
  103. # *********** Target list of PC machines ***********
  104. #
  105. # Don't worry about the ambiguity messages coming from antlr
  106. # for making antlr.c etc...  [should be 10 of them, I think]
  107. #
  108. #antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
  109. #    $(ANTLR) antlr.g
  110.  
  111. antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
  112.  
  113. scan.$(OBJ_EXT): scan.c mode.h tokens.h
  114.  
  115. #scan.c mode.h: parser.dlg
  116. #    $(DLG) -C2 parser.dlg scan.c
  117.  
  118. set.$(OBJ_EXT): $(SET)\set.c
  119.     $(CC) $(CFLAGS) /C $(OUT_OBJ)set.$(OBJ_EXT) $(SET)\set.c
  120.  
  121. #
  122. # what files does PCCTS generate (both ANTLR and DLG)
  123. #
  124.  
  125. PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
  126.  
  127. SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
  128.     hash.c lex.c main.c misc.c $(SET)\set.c pred.c dialog.c
  129.  
  130. #
  131. # ****** These next targets are common to UNIX and PC world ********
  132. #
  133.  
  134. #clean up all the intermediate files
  135. clean:
  136.     del *.$(OBJ_EXT) 
  137.  
  138. #remove everything in clean plus the PCCTS files generated
  139. scrub:
  140.     del $(PCCTS_GEN) *.$(OBJ_EXT) 
  141.  
  142. ----- cut here -----
  143.  
  144. To build DLG for the first time:
  145.  
  146. Follow the same steps as were used to build ANTLR, changing the slashes and
  147. commands, targets, and extensions for OS/2. Comment out the dependencies for
  148. dlg_p.c and dlg_a.c to prevent nmake from trying to invoke ANTLR and DLG to
  149. build DLG (unless you have 1.10 binaries).
  150.  
  151. An example of the resulting makefile, with all the extra baggage for Unix, DOS,
  152. and OS/2 1.X is shown here:
  153.  
  154. ----- cut here -----
  155.  
  156. #
  157. # Makefile for DLG 1.20
  158. # Terence Parr
  159. # Purdue University
  160. # 1989-1993
  161. #
  162. # Ported to IBM C-Set/2 and Microsoft 6.0 by
  163. # Ed Harfmann
  164. # Micro Data Base Systems
  165. # Lafayette, Indiana
  166. # - With updates by Steve Robenalt 4/94
  167. #
  168. SET=..\support\set
  169. PCCTS_H=..\h
  170.  
  171. #
  172. # C-Set/2 for OS/2
  173. #
  174. CC=icc
  175. CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3
  176. OUT_OBJ = /Fo
  177. LIBS=
  178. ANTLR=..\bin\antlr
  179. DLG=..\bin\dlg
  180. OBJ_EXT=obj
  181.  
  182. dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
  183.         output.obj relabel.obj automata.obj
  184.         link386 @<<
  185. $** /NOI
  186. $@ /STACK:32768
  187.  
  188. $(LIBS: = +^
  189. )
  190. $(DEF_FILE) $(LFLAGS) ;
  191. <<
  192.         copy *.exe ..\bin
  193.  
  194. SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c \
  195.         relabel.c automata.c
  196.  
  197. #dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
  198. #    $(ANTLR) dlg_p.g
  199.  
  200. #dlg_a.c mode.h : parser.dlg
  201. #    $(DLG) -C2 parser.dlg dlg_a.c
  202.  
  203. dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
  204.     $(CC) $(CFLAGS) /c dlg_p.c
  205.  
  206. dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
  207.     $(CC) $(CFLAGS) /c dlg_a.c
  208.  
  209. main.$(OBJ_EXT) : main.c dlg.h
  210.     $(CC) $(CFLAGS) /c main.c
  211.  
  212. set.$(OBJ_EXT) : $(SET)\set.c
  213.     $(CC) /c $(CFLAGS) $(SET)\set.c
  214.  
  215. lint:
  216.     lint *.c
  217.  
  218. #clean up all the intermediate files
  219. clean:
  220.     del *.$(OBJ_EXT) 
  221.  
  222. ----- cut here -----
  223.  
  224. Once you have built ANTLR and DLG successfully, you will also want to build
  225. the genmk utility, located at ~\pccts\support\genmk. The makefile in this 
  226. directory is relatively simple to modify, so I won't repeat it here.
  227.  
  228. At this point, you can test the executables by building one of the sample
  229. programs, such as the Pascal or C example under ~pccts\lang. The prototype
  230. makefile which is in these directories will work fine as a base, with OS/2
  231. specific modifications as noted above. Note that the /Sa flag defines the
  232. ANSI C mode of the compiler which is not the default. The default mode
  233. does not define __STDC__ and will lead to lots of errors.
  234.  
  235. A sample pascal makefile is shown below:
  236.  
  237. ----- cut here -----
  238.  
  239. GRM =pascal.g
  240. LEX_FILE =pscan.dlg
  241. GSRC=pascal.c err.c pscan.c ttree.c adebug.c
  242. GOBJ=pascal.obj err.obj pscan.obj ttree.obj adebug.obj
  243.  
  244. PCCTS_GEN= pascal.c err.c $(LEX_FILE) pscan.c mode.h tokens.h
  245.  
  246. SRC =$(GSRC) pmain.c sym.c
  247. OBJ =$(GOBJ) pmain.obj sym.obj
  248. INCL = ..\..\h
  249. SYM = ..\..\support\sym
  250. ANTLR = ..\..\bin\antlr
  251. DLG = ..\..\bin\dlg
  252.  
  253. CFLAGS=/I. /I$(INCL) /Sa
  254. AFLAGS= -fl $(LEX_FILE) -gh
  255.  
  256. pascal.exe : $(OBJ)
  257.     $(CC) $(CFLAGS) /Fopascal.exe $(OBJ)
  258.  
  259. pascal.c $(LEX_FILE) : $(GRM)
  260.     $(ANTLR) $(AFLAGS) $(GRM)
  261.  
  262. mode.h pscan.c : $(LEX_FILE)
  263.     $(DLG) -C2 $(LEX_FILE) pscan.c
  264.  
  265. pmain.obj : pmain.c pascal.h
  266.  
  267. pascal.obj : pascal.c mode.h tokens.h
  268.  
  269. sym.obj : $(SYM)\sym.c
  270.     icc /c /Fo sym.obj $(CFLAGS) $(SYM)\sym.c
  271.  
  272. err.obj : err.c
  273.  
  274. clean:
  275.     del $(PCCTS_GEN) *.obj
  276.  
  277.  
  278. ----- cut here -----
  279.  
  280. The C example can be built in much the same way.
  281.  
  282. If you have problems compiling anything, I would appreciate hearing about
  283. it. I was able to get everything built and working without changing any
  284. of the supplied or generated C code, so if you find that you need to make
  285. changes to any code, I've probably written something up incorrectly.
  286.  
  287. Please post comments to the mailing list for PCCTS at:
  288.  
  289.     pccts-users@ahpcrc.umn.edu
  290.  
  291. since I am most likely to see them there.
  292.  
  293. - Steve Robenalt
  294.  
  295.  
  296.